import request from '@/utils/request'

// 查询采购订单列表
export function listOrder(query) {
  return request({
    url: '/purchasing/order/list',
    method: 'get',
    params: query
  })
}

// 查询采购订单列表
export function getOrderByState() {
  return request({
    url: '/purchasing/order/list/state',
    method: 'get',
  })
}

// 查询采购订单列表
export function getOrderByStateToRefund() {
  return request({
    url: '/purchasing/order/list/stateToRefund',
    method: 'get',
  })
}
// 查询采购订单详细
export function getOrder(oderId) {
  return request({
    url: '/purchasing/order/' + oderId,
    method: 'get'
  })
}

// 新增采购订单
export function addOrder(data) {
  return request({
    url: '/purchasing/order',
    method: 'post',
    data: data
  })
}

// 审核采购订单
export function changeOrderState(oderId) {
  return request({
    url: '/purchasing/order/state/'+ oderId,
    method: 'get',
  })
}

// 修改采购订单
export function updateOrder(data) {
  return request({
    url: '/purchasing/order',
    method: 'put',
    data: data
  })
}

// 删除采购订单
export function delOrder(oderId) {
  return request({
    url: '/purchasing/order/' + oderId,
    method: 'delete'
  })
}
